package com.woniuxy.main.provider;

import org.apache.ibatis.jdbc.SQL;

import com.woniuxy.main.pojo.User;

public class UserProvider {
	public String updateUser(User user){
		SQL sql =new SQL().UPDATE("user");
		
		if(user.getNickName()!=null && user.getNickName().length()!=0){
			sql.SET("nickName='"+user.getNickName()+"'");
		}
		if(user.getAddress()!=null && user.getAddress().length()!=0){
			sql.SET("address='"+user.getAddress()+"'");
		}
		if(user.getUphone()!=null && user.getUphone().length()!=0){
			sql.SET("uphone='"+user.getUphone()+"'");
		}
		if(user.getUmail()!=null && user.getUmail().length()!=0){
			sql.SET("umail='"+user.getUmail()+"'");
		}		


		if(user.getUserRole()!=null && user.getUserRole().length()!=0){
			sql.SET("userRole='"+user.getUserRole()+"'");
		}
		
		sql.WHERE("uid="+user.getUid());

		return sql.toString();
	}
}
